package com.hoongs.v1.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.hoongs.v1.utils.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Repository;

import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Repository
@TableName(value = "advertise")
@JsonIgnoreProperties(value = {"createTime", "updateTime"})
public class Advertise {

    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    @NotBlank(message = "广告名称不能为空")
    @TableField(value = "name")
    private String name;      // 广告名称

    @NotBlank(message = "广告图片不能为空")
    private String image;      // 广告图片

    private String url;      // 广告链接

    private String status = "1";      // 广告状态 1:正常 2:禁用

    private String summary;      // 广告介绍

    @NotBlank(message = "广告排序值不能为空")
    private String sortcode;      // 广告排序值

    private String remark;      // 广告备注

    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private LocalDateTime createTime;       // 发布时间

    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;    // 更新时间

}
